<template>
  <div class="headerCodeGenerator-class">
    <el-tabs>
      <el-tab-pane label="配置">
        <ConfigPage
          @success="success"
        />
      </el-tab-pane>
      <el-tab-pane label="elementUIjs表头">
        <ElementUI
          :table-code-gen-items="deepClone(tableCodeGenItems)"
        />
      </el-tab-pane>
      <el-tab-pane label="vxeTablejs表头">
        <VxeTable
          :table-code-gen-items="deepClone(tableCodeGenItems)"
        />
      </el-tab-pane>
      <el-tab-pane label="easyExcelJavaBean">
        <CodeHighlightjs language="java" :code="easyJavaBean"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import CodeHighlightjs from "@localModules/ZhiXinLib/components/CodeHighlightjs";
import {deepClone} from "@localModules/ZhiXinLib/utils/index";
import tableCodeGenUtils from "@/utils/tableCodeGenUtils";
import {genNumber} from "@/views/utils/views/excel2Table/common";
import {TimeUtils} from "@localModules/ZhiXinLib/utils/TimeUtils";

export default {
  name: "Excel2Table",
  components: {
    ConfigPage:()=>import('./ConfigPage'),
    ElementUI:()=>import('./ElementUI'),
    VxeTable:()=>import('./VxeTable'),
    CodeHighlightjs,
  },
  data() {
    return {
      deepClone,
      easyJavaBean: `package top.xzxsrq.genutils.excel.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;

/**
 * @program: zhixin前端生成
 * @create: ${TimeUtils.parseTime(new Date(), 'YYYY-MM-DD HH:mm')}
 **/
@Data
public class ZhiXinExcelVo {
}
`,
      tableCodeGenItems: []
    }
  },
  methods:{
    success(tableCodeGenItems=[]){
      this.tableCodeGenItems = tableCodeGenItems
      this.easyJavaBean = tableCodeGenUtils.tableHeadToEasyJavaBean(tableCodeGenItems, genNumber);
    }
  }
}
</script>

<style scoped lang="scss">
</style>
